#ifndef MD_THREAD_H
#define MD_THREAD_H


#include "common_conf.h"
#include <pthread.h>

#define MUTEX_NAME_LEN	32
enum	mutex_sta{
	MUTEX_STA_LOCK,
	MUTEX_STA_UNLOCK,
};

typedef struct	_t_thread_mutex{
	char 			acmutex_name[MUTEX_NAME_LEN];
	pthread_mutex_t	thread_mutex;
	enum mutex_sta	emutex_sta;
}t_thread_mutex,*pt_thread_mutex;

int md_thread_mutex_init(pt_thread_mutex ptmutex_arg,char *pcname);
int md_thread_mutex_lock(pt_thread_mutex ptmutex_arg);
int md_thread_mutex_unlock(pt_thread_mutex ptmutex_arg);

int md_set_stacksize_create_thread(pthread_t *__restrict __newthread,
                    size_t istacksize,
			        void *(*__start_routine) (void *),
			        void *__restrict __arg);

int md_default_create_thread(pthread_t *__restrict __newthread,
			   const pthread_attr_t *__restrict __attr,
			   void *(*__start_routine) (void *),
			   void *__restrict __arg);

void md_thread_exit(void *retval);




#endif